<?php defined('_JEXEC') or die('Restricted access'); ?>

<form action="index.php" method="post" name="adminForm" id="adminForm">
    <div class="col100">
        <fieldset class="adminform">
            <?php
            $cislo_tydne_str = strval($this->tydny->tyden_cislo);
            $rok_str = strval($this->tydny->rok);
            $ode_dne_str = '';
            $dateTime_obj = new DateTime($this->tydny->ode_dne);
            if (is_object($dateTime_obj)) {
                $ode_dne_str = $dateTime_obj->format('d. m. Y');
            }
            $text_detailu = 'Doplnění popisů dnů '.$cislo_tydne_str.'. týdne, roku '.$rok_str.' od pondělí dne '.$ode_dne_str;
            $barvy_obj_list = $this->tydny->barvy_obj_arr;
            ?>
            <legend><?php echo JText::_( $text_detailu ); ?></legend>

            <table class="admintable">

<?php
if (empty($this->tydny->id)) {
    ?>

                <tr>
                    <td width="100" align="right" class="key">
                        <label for="sablona_id">
                            <?php echo JText::_( 'Šablona' ); ?>:
                        </label>
                    </td>
                    <td colspan="3">
                        <select name="sablona_id">

    <?php
    echo '<option value=0> ';
    $sablony_obj_list = $this->tydny->sablony_obj_arr;
    if (is_array($sablony_obj_list)) {
        foreach ($sablony_obj_list as $sablona_obj) {
            echo '<option value="'.$sablona_obj->id.'">'.$sablona_obj->nazev;
        }
    }
    ?>
                        </select>
                    </td>
                </tr>

    <?php
}
?>

                <tr>
                    <td width="100" align="right" class="key">
                        <label for="litur_po">
                            <?php
                            $datum_str = $dateTime_obj->format('d. m. Y');
                            echo $datum_str.' '.JText::_( 'PO' );
                            ?>:
                        </label>
                    </td>
                    <td>
                        <input class="text_area" type="text" name="litur_po" id="litur_po" size="32" maxlength="250" value="<?php echo $this->tydny->litur_po;?>" />
                    </td>
                    <td width="100" align="right" class="key">
                        <label for="barva_po">
                            <?php echo JText::_( 'barva dne' ); ?>:
                        </label>
                    </td>
                    <td>
                        <select name="barva_po">

<?php
$puvodni_barva_name = $this->tydny->barva_po;
$puvodni_barva_nazev = '';
if (!empty($puvodni_barva_name)) {
    foreach ($barvy_obj_list as $barva_obj) {
        if ($barva_obj->name == $puvodni_barva_name) {
            $puvodni_barva_nazev = $barva_obj->nazev;
        }
    }
}
echo '<option value="'.$puvodni_barva_name.'">'.$puvodni_barva_nazev;
if (is_array($barvy_obj_list)) {
    foreach ($barvy_obj_list as $barva_obj) {
        echo '<option value="'.$barva_obj->name.'">'.$barva_obj->nazev;
    }
}
?>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td width="100" align="right" class="key">
                        <label for="litur_ut">
                            <?php
                            $dateTime_obj->modify("+1 day");
                            $datum_str = $dateTime_obj->format('d. m. Y');
                            echo $datum_str.' '.JText::_( 'ÚT' );
                            ?>:
                        </label>
                    </td>
                    <td>
                        <input class="text_area" type="text" name="litur_ut" id="litur_ut" size="32" maxlength="250" value="<?php echo $this->tydny->litur_ut;?>" />
                    </td>
                    <td width="100" align="right" class="key">
                        <label for="barva_ut">
                            <?php echo JText::_( 'barva dne' ); ?>:
                        </label>
                    </td>
                    <td>
                        <select name="barva_ut">

<?php
$puvodni_barva_name = $this->tydny->barva_ut;
$puvodni_barva_nazev = '';
if (!empty($puvodni_barva_name)) {
    foreach ($barvy_obj_list as $barva_obj) {
        if ($barva_obj->name == $puvodni_barva_name) {
            $puvodni_barva_nazev = $barva_obj->nazev;
        }
    }
}
echo '<option value="'.$puvodni_barva_name.'">'.$puvodni_barva_nazev;
if (is_array($barvy_obj_list)) {
    foreach ($barvy_obj_list as $barva_obj) {
        echo '<option value="'.$barva_obj->name.'">'.$barva_obj->nazev;
    }
}
?>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td width="100" align="right" class="key">
                        <label for="litur_st">
                            <?php
                            $dateTime_obj->modify("+1 day");
                            $datum_str = $dateTime_obj->format('d. m. Y');
                            echo $datum_str.' '.JText::_( 'ST' );
                            ?>:
                        </label>
                    </td>
                    <td>
                        <input class="text_area" type="text" name="litur_st" id="litur_st" size="32" maxlength="250" value="<?php echo $this->tydny->litur_st;?>" />
                    </td>
                    <td width="100" align="right" class="key">
                        <label for="barva_st">
                            <?php echo JText::_( 'barva dne' ); ?>:
                        </label>
                    </td>
                    <td>
                        <select name="barva_st">

<?php
$puvodni_barva_name = $this->tydny->barva_st;
$puvodni_barva_nazev = '';
if (!empty($puvodni_barva_name)) {
    foreach ($barvy_obj_list as $barva_obj) {
        if ($barva_obj->name == $puvodni_barva_name) {
            $puvodni_barva_nazev = $barva_obj->nazev;
        }
    }
}
echo '<option value="'.$puvodni_barva_name.'">'.$puvodni_barva_nazev;
if (is_array($barvy_obj_list)) {
    foreach ($barvy_obj_list as $barva_obj) {
        echo '<option value="'.$barva_obj->name.'">'.$barva_obj->nazev;
    }
}
?>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td width="100" align="right" class="key">
                        <label for="litur_ct">
                            <?php
                            $dateTime_obj->modify("+1 day");
                            $datum_str = $dateTime_obj->format('d. m. Y');
                            echo $datum_str.' '.JText::_( 'ČT' );
                            ?>:
                        </label>
                    </td>
                    <td>
                        <input class="text_area" type="text" name="litur_ct" id="litur_ct" size="32" maxlength="250" value="<?php echo $this->tydny->litur_ct;?>" />
                    </td>
                    <td width="100" align="right" class="key">
                        <label for="barva_ct">
                            <?php echo JText::_( 'barva dne' ); ?>:
                        </label>
                    </td>
                    <td>
                        <select name="barva_ct">

<?php
$puvodni_barva_name = $this->tydny->barva_ct;
$puvodni_barva_nazev = '';
if (!empty($puvodni_barva_name)) {
    foreach ($barvy_obj_list as $barva_obj) {
        if ($barva_obj->name == $puvodni_barva_name) {
            $puvodni_barva_nazev = $barva_obj->nazev;
        }
    }
}
echo '<option value="'.$puvodni_barva_name.'">'.$puvodni_barva_nazev;
if (is_array($barvy_obj_list)) {
    foreach ($barvy_obj_list as $barva_obj) {
        echo '<option value="'.$barva_obj->name.'">'.$barva_obj->nazev;
    }
}
?>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td width="100" align="right" class="key">
                        <label for="litur_pa">
                            <?php
                            $dateTime_obj->modify("+1 day");
                            $datum_str = $dateTime_obj->format('d. m. Y');
                            echo $datum_str.' '.JText::_( 'PÁ' );
                            ?>:
                        </label>
                    </td>
                    <td>
                        <input class="text_area" type="text" name="litur_pa" id="litur_pa" size="32" maxlength="250" value="<?php echo $this->tydny->litur_pa;?>" />
                    </td>
                    <td width="100" align="right" class="key">
                        <label for="barva_pa">
                            <?php echo JText::_( 'barva dne' ); ?>:
                        </label>
                    </td>
                    <td>
                        <select name="barva_pa">

<?php
$puvodni_barva_name = $this->tydny->barva_pa;
$puvodni_barva_nazev = '';
if (!empty($puvodni_barva_name)) {
    foreach ($barvy_obj_list as $barva_obj) {
        if ($barva_obj->name == $puvodni_barva_name) {
            $puvodni_barva_nazev = $barva_obj->nazev;
        }
    }
}
echo '<option value="'.$puvodni_barva_name.'">'.$puvodni_barva_nazev;
if (is_array($barvy_obj_list)) {
    foreach ($barvy_obj_list as $barva_obj) {
        echo '<option value="'.$barva_obj->name.'">'.$barva_obj->nazev;
    }
}
?>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td width="100" align="right" class="key">
                        <label for="litur_so">
                            <?php
                            $dateTime_obj->modify("+1 day");
                            $datum_str = $dateTime_obj->format('d. m. Y');
                            echo $datum_str.' '.JText::_( 'SO' );
                            ?>:
                        </label>
                    </td>
                    <td>
                        <input class="text_area" type="text" name="litur_so" id="litur_so" size="32" maxlength="250" value="<?php echo $this->tydny->litur_so;?>" />
                    </td>
                    <td width="100" align="right" class="key">
                        <label for="barva_so">
                            <?php echo JText::_( 'barva dne' ); ?>:
                        </label>
                    </td>
                    <td>
                        <select name="barva_so">

<?php
$puvodni_barva_name = $this->tydny->barva_so;
$puvodni_barva_nazev = '';
if (!empty($puvodni_barva_name)) {
    foreach ($barvy_obj_list as $barva_obj) {
        if ($barva_obj->name == $puvodni_barva_name) {
            $puvodni_barva_nazev = $barva_obj->nazev;
        }
    }
}
echo '<option value="'.$puvodni_barva_name.'">'.$puvodni_barva_nazev;
if (is_array($barvy_obj_list)) {
    foreach ($barvy_obj_list as $barva_obj) {
        echo '<option value="'.$barva_obj->name.'">'.$barva_obj->nazev;
    }
}
?>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td width="100" align="right" class="key">
                        <label for="litur_ne">
                            <?php
                            $dateTime_obj->modify("+1 day");
                            $datum_str = $dateTime_obj->format('d. m. Y');
                            echo $datum_str.' '.JText::_( 'NE' );
                            ?>:
                        </label>
                    </td>
                    <td>
                        <input class="text_area" type="text" name="litur_ne" id="litur_ne" size="32" maxlength="250" value="<?php echo $this->tydny->litur_ne;?>" />
                    </td>
                    <td width="100" align="right" class="key">
                        <label for="barva_ne">
                            <?php echo JText::_( 'barva dne' ); ?>:
                        </label>
                    </td>
                    <td>
                        <select name="barva_ne">

<?php
$puvodni_barva_name = $this->tydny->barva_ne;
$puvodni_barva_nazev = '';
if (!empty($puvodni_barva_name)) {
    foreach ($barvy_obj_list as $barva_obj) {
        if ($barva_obj->name == $puvodni_barva_name) {
            $puvodni_barva_nazev = $barva_obj->nazev;
        }
    }
}
echo '<option value="'.$puvodni_barva_name.'">'.$puvodni_barva_nazev;
if (is_array($barvy_obj_list)) {
    foreach ($barvy_obj_list as $barva_obj) {
        echo '<option value="'.$barva_obj->name.'">'.$barva_obj->nazev;
    }
}
?>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td width="100" align="right" class="key">
                        <label for="zverejnen">
                            <?php echo JText::_( 'Zveřejnit týden' ); ?>:
                        </label>
                    </td>
                    <td colspan="3">
                        <?php
                        $zverejnen_old_str = '';
                        if ($this->tydny->zverejnen == 1) {
                            $zverejnen_old_str = 'Ano';
                        } else {
                            $zverejnen_old_str = 'Ne';
                        }

                        ?>
                        <select name="zverejnen">
                            <?php
                            echo '<option value="'.$this->tydny->zverejnen.'">'.$zverejnen_old_str.'</option>';
                            echo '<option value=0> Ne </option>';
                            echo '<option value=1> Ano </option>';
                            ?>
                        </select>
                    </td>
                </tr>
            </table>
            <p>

            </p>
        </fieldset>
    </div>






    <input type="hidden" name="option" value="com_ohlasky" />
    <input type="hidden" name="id" value="<?php echo $this->tydny->id; ?>" />
    <input type="hidden" name="tyden_cislo" value="<?php echo $this->tydny->tyden_cislo; ?>" />
    <input type="hidden" name="rok" value="<?php echo $this->tydny->rok; ?>" />
    <input type="hidden" name="ode_dne" value="<?php echo $this->tydny->ode_dne; ?>" />
    <input type="hidden" name="task" value="" />
    <input type="hidden" name="controller" value="tydny" />


</form>

